load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "restore",
    srcs = [
        "import_mode_switcher.go",
        "misc.go",
    ],
    importpath = "github.com/pingcap/tidb/br/pkg/restore",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/conn",
        "//br/pkg/conn/util",
        "//br/pkg/errors",
        "//br/pkg/logutil",
        "//br/pkg/pdutil",
        "//br/pkg/utils",
        "//pkg/domain",
        "//pkg/kv",
        "//pkg/meta",
        "//pkg/meta/model",
        "//pkg/parser/model",
        "//pkg/util",
        "@com_github_go_sql_driver_mysql//:mysql",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/import_sstpb",
        "@com_github_pingcap_log//:log",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_pd_client//:client",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//backoff",
        "@org_golang_google_grpc//credentials",
        "@org_golang_google_grpc//credentials/insecure",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "restore_test",
    timeout = "short",
    srcs = [
        "import_mode_switcher_test.go",
        "misc_test.go",
    ],
    flaky = True,
    race = "off",
    shard_count = 6,
    deps = [
        ":restore",
        "//br/pkg/conn",
        "//br/pkg/mock",
        "//br/pkg/pdutil",
        "//br/pkg/utiltest",
        "//pkg/kv",
        "//pkg/parser/model",
        "//pkg/session",
        "@com_github_coreos_go_semver//semver",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/import_sstpb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_stretchr_testify//require",
        "@org_golang_google_grpc//:grpc",
    ],
)
